home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir34 / dsktest.zip / ERRLEV.BAT < prev    next >
DOS Batch File  |  1993-05-25  |  793b  |  22 lines

  1. @echo off
  2. rem Use CALL ERRLEV.BAT (DOS 3.3+) in a batch file to place the errorlevel
  3. rem into the environment as EL=xxx where xxx is an ASCII(!) string
  4. rem representation of the errorlevel. It is also written to the screen.
  5. set EL=
  6. for %%V in (0 1 2) do if errorlevel %%V00 set EL=%%V
  7. if "%EL%"=="2" goto OVER200
  8. for %%V in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %EL%%%V0 set EL=%EL%%%V
  9. goto DIGIT2
  10. :OVER200
  11. for %%V in (0 1 2 3 4 5) do if errorlevel %EL%%%V0 set EL=%EL%%%V
  12. :DIGIT2
  13. if "%EL%"=="25" goto OVER250
  14. goto DIGIT3
  15. :OVER250
  16. for %%V in (0 1 2 3 4 5) do if errorlevel %EL%%%V set EL=%EL%%%V
  17. goto DONE
  18. :DIGIT3
  19. for %%V in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %EL%%%V set EL=%EL%%%V
  20. :DONE
  21. echo The resulting ERRORLEVEL value transferred to the environment is EL=%EL%
  22.